﻿using eProcurement.BLL;
using eProcurement.controls;
using eProcurement.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eProcurement.members
{
    public partial class MyBids : System.Web.UI.Page
    {
        protected void Page_Load( object sender, EventArgs e )
        {
            if ( !IsPostBack )
            {
                Manager manager = new Manager();

                if ( Request[ "dbid" ] != null )
                {
                    manager.DeleteBid( Convert.ToInt32( Request[ "dbid" ] ) );
                }

                List<Bid> bids = new List<Bid>();
                bids = new Manager().GetMyBids( Context.User.Identity.Name );

                if ( bids != null )
                {
                    foreach ( Bid bid in bids )
                    {
                        MyBidsItemControl control = (MyBidsItemControl)LoadControl( "../controls/MyBidsItemControl.ascx" );
                        control.Setup( bid );
                        container.Controls.Add( control );
                    }
                }
            }
        }
    }
}